package formula.web;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import org.primefaces.event.TabChangeEvent;
import org.slf4j.LoggerFactory;

@ManagedBean
@SessionScoped
public class Menu {

	private final org.slf4j.Logger logger = LoggerFactory.getLogger(getClass());

	private int activeIndex;

	public int getActiveIndex() {
		// logger.debug(" GET activeInxe=" + activeIndex);
		return activeIndex;
	}

	public void setActiveIndex(int _activeIndex) {
		// logger.debug(" SET activeInxe=" + activeIndex);
		activeIndex = _activeIndex;
	}

	public void changeActiveIndex(TabChangeEvent _changeEvent) {
		String idStr = _changeEvent.getTab().getId();
		if (idStr.equals("driversTab")) {
			activeIndex = 0;
		}
		if (idStr.equals("teamsTab")) {
			activeIndex = 1;
		}
		if (idStr.equals("levelsTab")) {
			activeIndex = 2;
		}
		// logger.debug(" CHANGE activeInxe=" + activeIndex);
	}
}
